package ar.com.pragmatia.lanacion;

import java.util.Vector;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import ar.com.pragmatia.lanacion.data.AppData;
import ar.com.pragmatia.lanacion.data.Client;

public class ClientsAdapter extends BaseAdapter {

	private Context mContext;

	public ClientsAdapter(Context c) {
		mContext = c;
		Client client = new Client();
		clients = client.find();
	}

	public int getCount() {
		return clients.size();
	}

	public Object getItem(int position) {
		return null;
	}

	public long getItemId(int position) {
		return new Long(clients.get(position).getId()).longValue();
	}

	// create a new ImageView for each item referenced by the Adapter
	public View getView(int position, View convertView, ViewGroup parent) {
		TextView textView;
		if (convertView == null) { // if it's not recycled, initialize some
									// attributes
			textView = new TextView(mContext);
//			textView.setLayoutParams(new GridView.LayoutParams(85, 85));
			textView.setPadding(8, 8, 8, 8);
		} else {
			textView = (TextView) convertView;
		}

		textView.setText(clients.get(position).toString());
		return textView;
	}

	// references to our images
	private Vector<AppData> clients;

}
